package com.datastructure

/**
 * @description:
 *
 *  Array is mutable.
 *  Although you can’t change the length of an array after it is instantiated,
 *  you can change its element values. Thus, arrays are mutable objects
 *
 * @author: marshal
 * @date: 2021-08-09 3:55 PM
 */
object ArrayTest extends App {

  // declare
  var names = new Array[String](3)

  // set value
  names(0) = "Tom"
  names(1) = "Jack"
  names(2) = "Rose"

  // print
  println(names) // [Ljava.lang.String;@5f150435
  for (i <- 0 to (names.length - 1)) println(names(i))

}
